# -*- coding: utf-8 -*-

<%def name="link_to(student, attribute=None, classes=None, id=None)">
  % if student:
  <%
    classes_t = classes and 'class="%s"' % " ".join(classes) or ""
    id_t = id and 'id="%s"' % id or ""
  %>
  <a href="${h.url_for('student', id=student.id)}" ${classes_t} ${id_t}>
    % if attribute is None:
     ${student.firstname|h} ${student.lastname|h}\
    % else:
     ${getattr(student, attribute)|h}\
    % endif
  </a>
  % else:
    -
  % endif
</%def>
